using UnityEngine;
using UnityEngine.UI;

namespace Core.Extension
{
    /// <summary>
    /// 用来射线检测（不会产生额外Draw Call）
    /// </summary>
    [RequireComponent(typeof(CanvasRenderer))]
    public class EmptyRaycast : Graphic
    {
        public override void SetMaterialDirty()
        {
            return;
        }

        public override void SetVerticesDirty()
        {
            return;
        }

        /// Probably not necessary since the chain of calls `Rebuild()`->`UpdateGeometry()`->`DoMeshGeneration()`->`OnPopulateMesh()` won't happen; so here really just as a fail-safe.
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            vh.Clear();
            return;
        }
    }
}